Skip to content

feat(crew): mail mayor before actions requiring human intervention#3508

Open
n43-ryan wants to merge 4 commits intogastownhall:mainfrom
N43-Studio:main
Open

feat(crew): mail mayor before actions requiring human intervention#3508
n43-ryan wants to merge 4 commits intogastownhall:mainfrom
N43-Studio:main

Conversation

@n43-ryan
Copy link
Copy Markdown
Contributor

@n43-ryan n43-ryan commented Apr 2, 2026

Summary

  • Crew agents now send HUMAN_INPUT_REQUIRED mail to mayor before attempting actions that will block on a permission prompt
  • Covers .claude/ directory edits, destructive ops, and any tool call that triggers a permission dialog
  • Agent mails mayor, nudges, then proceeds immediately — mayor notifies the user to come unblock

Context

Upstream already addresses permission prompts at the infrastructure layer (--dangerously-skip-permissions, AcceptStartupDialogs tmux auto-dismiss, witness dialog auto-dismiss in DismissStartupDialogsBlind). This PR targets the residual case those mechanisms don't cover: Claude Code's own .claude/ configuration files, which remain protected even under --dangerously-skip-permissions.

When a crew agent attempts to edit .claude/commands/ or settings.json, Claude Code presents an interactive confirmation that blocks indefinitely in an autonomous session. This protocol gives the human a path to unblock it.

Protocol added

gt mail send mayor/ -s "HUMAN_INPUT_REQUIRED: <brief description>" --stdin <<'BODY'
About to: <describe the action>
Why: <why you need to do this>
What will happen: The agent will block on a permission prompt until the user approves.
BODY
gt nudge mayor "Check mail — human approval needed"
# Then proceed immediately — do NOT wait for reply

Follow-up (out of scope for this PR)

A PreToolUse hook that auto-detects .claude/ write attempts and fires the mail+nudge automatically would be more robust than an instructions-layer protocol. Tracked separately.

Test plan

  • Crew agent encountering a .claude/ edit mails mayor before attempting
  • Mayor receives HUMAN_INPUT_REQUIRED subject
  • Agent proceeds without waiting for reply (does not deadlock)
  • Non-crew agents (polecats, witnesses) unaffected

🤖 Generated with Claude Code

n43-ryan and others added 4 commits April 2, 2026 12:04
When a polecat works on a cross-rig bead (e.g., hq-xxx), bd.Create
for the MR bead would resolve to the town-level database instead of
the rig's database. The refinery scans only its own database, so it
never found the MR and the branch sat unmerged indefinitely.

Fix: add Rig field to CreateOptions (passes --rig to bd create) and
set Rig: rigName when creating the MR bead in done.go. The rig name
is already available in the done context (written to the MR description's
rig: field), so no new lookups are required.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…-gpy)

Add ValidateRigPrefix() to internal/beads/routes.go — a post-creation
guard that warns when a newly created bead's prefix doesn't match the
expected rig prefix. This catches cases where bd create routing resolves
to the wrong database despite Rig being set.

Apply the guard (warning-only, never blocks) at:
- cmd/done.go: MR bead creation (primary path)
- cmd/mq_submit.go: MR bead creation (alternate path) + add Rig: rigName
- refinery/engineer.go: conflict resolution task creation + add Rig: rigName

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…t-02c)

Adds HUMAN_INPUT_REQUIRED protocol to crew agent context. When a crew agent
anticipates an action that will block on a permission prompt (.claude/ edits,
destructive ops, dangerously-skip-permissions-protected actions), it should
mail mayor with subject 'HUMAN_INPUT_REQUIRED: <description>' and nudge mayor,
then proceed immediately. Mayor notifies the user to come unblock the prompt.

- Bumps gastown-agent-instructions to v2 in AGENTS.md
- Adds "When Human Approval is Required" section to crew.md.tmpl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status/needs-triage Inbox — we haven't looked at it yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant